<template>
  <div class="contact-teacher">
    <!-- 页面头部 -->
    <div class="page-header">
      <button class="back-btn" @click="goBack">
        ← 返回
      </button>
      <h1>💬 联系老师</h1>
      <div class="header-actions">
        <button class="action-btn search-btn" @click="showSearch = true">
          🔍 搜索老师
        </button>
      </div>
    </div>

    <!-- 主要内容 -->
    <div class="content-container">
      <div class="contact-layout">
        <!-- 左侧：老师列表 -->
        <div class="teachers-sidebar">
          <div class="sidebar-header">
            <h2>👩‍🏫 我的老师</h2>
            <button class="add-teacher-btn" @click="showAddTeacher = true">➕</button>
          </div>
          
          <div class="teachers-list">
            <div 
              v-for="teacher in teachers" 
              :key="teacher.id"
              class="teacher-item"
              :class="{ active: selectedTeacher?.id === teacher.id }"
              @click="selectTeacher(teacher)"
            >
              <div class="teacher-avatar">
                <img :src="teacher.avatar" :alt="teacher.name" />
                <span v-if="teacher.unreadCount > 0" class="unread-badge">{{ teacher.unreadCount }}</span>
                <span v-if="teacher.isOnline" class="online-dot"></span>
              </div>
              <div class="teacher-info">
                <div class="teacher-name">{{ teacher.name }}</div>
                <div class="teacher-subject">{{ teacher.subject }}</div>
                <div class="teacher-last-message">{{ teacher.lastMessage }}</div>
              </div>
              <div class="teacher-time">{{ teacher.lastTime }}</div>
            </div>
          </div>
        </div>

        <!-- 右侧：聊天界面 -->
        <div class="chat-main">
          <div v-if="selectedTeacher" class="chat-container">
            <!-- 聊天头部 -->
            <div class="chat-header">
              <div class="chat-teacher-info">
                <div class="chat-avatar">
                  <img :src="selectedTeacher.avatar" :alt="selectedTeacher.name" />
                  <span v-if="selectedTeacher.isOnline" class="online-dot"></span>
                </div>
                <div class="chat-info">
                  <div class="chat-name">{{ selectedTeacher.name }}</div>
                  <div class="chat-status">
                    <span v-if="selectedTeacher.isOnline" class="status-online">在线</span>
                    <span v-else class="status-offline">离线</span>
                  </div>
                </div>
              </div>
              <div class="chat-actions">
                <button class="chat-action-btn" @click="showTeacherInfo = true" title="查看资料">
                  ℹ️
                </button>
                <button class="chat-action-btn" @click="showCallModal = true" title="语音通话">
                  📞
                </button>
                <button class="chat-action-btn" @click="showVideoModal = true" title="视频通话">
                  📹
                </button>
              </div>
            </div>

            <!-- 消息列表 -->
            <div class="messages-container" ref="messagesContainer">
              <div 
                v-for="message in messages" 
                :key="message.id"
                class="message-item"
                :class="{ 'own-message': message.isOwn }"
              >
                <div v-if="!message.isOwn" class="message-avatar">
                  <img :src="selectedTeacher.avatar" :alt="selectedTeacher.name" />
                </div>
                <div class="message-content">
                  <div class="message-header">
                    <span class="message-sender">{{ message.isOwn ? '我' : selectedTeacher.name }}</span>
                    <span class="message-time">{{ message.time }}</span>
                  </div>
                  <div class="message-text">{{ message.text }}</div>
                  <div v-if="message.attachments && message.attachments.length > 0" class="message-attachments">
                    <div 
                      v-for="(attachment, index) in message.attachments" 
                      :key="index"
                      class="attachment-item"
                    >
                      📎 {{ attachment.name }}
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 输入区域 -->
            <div class="message-input-area">
              <div class="input-toolbar">
                <button class="toolbar-btn" @click="showEmojiPicker = !showEmojiPicker" title="表情">
                  😊
                </button>
                <button class="toolbar-btn" @click="showFilePicker = true" title="文件">
                  📎
                </button>
                <button class="toolbar-btn" @click="showImagePicker = true" title="图片">
                  🖼️
                </button>
              </div>
              <div v-if="showEmojiPicker" class="emoji-picker">
                <span 
                  v-for="emoji in commonEmojis" 
                  :key="emoji"
                  class="emoji-item"
                  @click="insertEmoji(emoji)"
                >
                  {{ emoji }}
                </span>
              </div>
              <div class="input-wrapper">
                <textarea 
                  v-model="newMessage"
                  class="message-input"
                  placeholder="输入消息..."
                  rows="3"
                  @keydown.enter.exact.prevent="sendMessage"
                  @keydown.enter.shift.exact="newMessage += '\n'"
                ></textarea>
                <button class="send-btn" @click="sendMessage" :disabled="!newMessage.trim()">
                  发送
                </button>
              </div>
            </div>
          </div>

          <!-- 未选择老师时的提示 -->
          <div v-else class="no-teacher-selected">
            <div class="empty-icon">💬</div>
            <h3>选择一个老师开始聊天</h3>
            <p>从左侧列表中选择一位老师，或添加新老师</p>
            <button class="add-teacher-main-btn" @click="showAddTeacher = true">
              ➕ 添加老师
            </button>
          </div>
        </div>
      </div>

      <!-- 快速联系卡片 -->
      <div class="quick-contact-section">
        <h2>⚡ 快速联系</h2>
        <div class="quick-contact-grid">
          <div class="quick-contact-card" @click="quickContact('question')">
            <div class="quick-icon">❓</div>
            <div class="quick-title">学习问题</div>
            <div class="quick-desc">咨询孩子学习情况</div>
          </div>
          <div class="quick-contact-card" @click="quickContact('progress')">
            <div class="quick-icon">📊</div>
            <div class="quick-title">学习进度</div>
            <div class="quick-desc">了解学习进展</div>
          </div>
          <div class="quick-contact-card" @click="quickContact('homework')">
            <div class="quick-icon">📝</div>
            <div class="quick-title">作业问题</div>
            <div class="quick-desc">询问作业相关</div>
          </div>
          <div class="quick-contact-card" @click="quickContact('suggestion')">
            <div class="quick-icon">💡</div>
            <div class="quick-title">学习建议</div>
            <div class="quick-desc">获取学习建议</div>
          </div>
        </div>
      </div>

      <!-- 常见问题 -->
      <div class="faq-section">
        <h2>❓ 常见问题</h2>
        <div class="faq-list">
          <div 
            v-for="(faq, index) in faqs" 
            :key="index"
            class="faq-item"
            @click="toggleFaq(index)"
          >
            <div class="faq-question">
              <span>{{ faq.question }}</span>
              <span class="faq-toggle">{{ expandedFaqs.includes(index) ? '−' : '+' }}</span>
            </div>
            <div v-if="expandedFaqs.includes(index)" class="faq-answer">
              {{ faq.answer }}
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 添加老师弹窗 -->
    <div v-if="showAddTeacher" class="modal-overlay" @click="showAddTeacher = false">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h3>添加老师</h3>
          <button class="modal-close" @click="showAddTeacher = false">×</button>
        </div>
        <div class="modal-body">
          <div class="form-group">
            <label>搜索老师</label>
            <input 
              type="text" 
              v-model="searchTeacherQuery" 
              placeholder="输入老师姓名或ID"
              class="form-input"
            >
          </div>
          <div class="search-results">
            <div 
              v-for="teacher in searchResults" 
              :key="teacher.id"
              class="search-result-item"
              @click="addTeacher(teacher)"
            >
              <img :src="teacher.avatar" :alt="teacher.name" class="result-avatar">
              <div class="result-info">
                <div class="result-name">{{ teacher.name }}</div>
                <div class="result-subject">{{ teacher.subject }}</div>
              </div>
              <button class="add-btn">添加</button>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 老师信息弹窗 -->
    <div v-if="showTeacherInfo && selectedTeacher" class="modal-overlay" @click="showTeacherInfo = false">
      <div class="modal-content teacher-info-modal" @click.stop>
        <div class="modal-header">
          <h3>老师资料</h3>
          <button class="modal-close" @click="showTeacherInfo = false">×</button>
        </div>
        <div class="modal-body">
          <div class="teacher-profile">
            <img :src="selectedTeacher.avatar" :alt="selectedTeacher.name" class="profile-avatar">
            <h3>{{ selectedTeacher.name }}</h3>
            <p class="profile-subject">{{ selectedTeacher.subject }}</p>
            <div class="profile-info">
              <div class="info-item">
                <span class="info-label">教学经验</span>
                <span class="info-value">{{ selectedTeacher.experience }}年</span>
              </div>
              <div class="info-item">
                <span class="info-label">学生评价</span>
                <span class="info-value">⭐ {{ selectedTeacher.rating }}/5.0</span>
              </div>
              <div class="info-item">
                <span class="info-label">在线时间</span>
                <span class="info-value">{{ selectedTeacher.onlineHours }}</span>
              </div>
            </div>
            <div class="profile-description">
              <h4>个人简介</h4>
              <p>{{ selectedTeacher.description }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ContactTeacher',
  data() {
    return {
      selectedTeacher: null,
      showAddTeacher: false,
      showTeacherInfo: false,
      showEmojiPicker: false,
      showFilePicker: false,
      showImagePicker: false,
      showSearch: false,
      showCallModal: false,
      showVideoModal: false,
      newMessage: '',
      expandedFaqs: [],
      searchTeacherQuery: '',
      teachers: [
        {
          id: 1,
          name: '李老师',
          subject: '英语',
          avatar: 'https://via.placeholder.com/50/667eea/FFFFFF?text=李',
          lastMessage: '小明最近学习很认真，进步很大！',
          lastTime: '10:30',
          unreadCount: 2,
          isOnline: true,
          experience: '5',
          rating: '4.8',
          onlineHours: '周一至周五 9:00-18:00',
          description: '拥有5年英语教学经验，擅长儿童英语启蒙教育，注重培养孩子的学习兴趣。'
        },
        {
          id: 2,
          name: '王老师',
          subject: '英语',
          avatar: 'https://via.placeholder.com/50/764ba2/FFFFFF?text=王',
          lastMessage: '好的，我会关注一下',
          lastTime: '昨天',
          unreadCount: 0,
          isOnline: false,
          experience: '3',
          rating: '4.6',
          onlineHours: '周一至周五 14:00-20:00',
          description: '专注于幼儿英语教学，善于用游戏和互动的方式激发孩子的学习兴趣。'
        },
        {
          id: 3,
          name: '张老师',
          subject: '英语',
          avatar: 'https://via.placeholder.com/50/27ae60/FFFFFF?text=张',
          lastMessage: '建议每天坚持练习15分钟',
          lastTime: '2天前',
          unreadCount: 1,
          isOnline: true,
          experience: '7',
          rating: '4.9',
          onlineHours: '周一至周日 8:00-22:00',
          description: '资深英语教师，教学经验丰富，注重个性化教学，帮助每个孩子找到适合自己的学习方法。'
        }
      ],
      messages: [
        {
          id: 1,
          text: '您好，我是小明的家长，想了解一下他最近的学习情况。',
          time: '09:15',
          isOwn: true
        },
        {
          id: 2,
          text: '您好！小明最近学习很认真，特别是在单词游戏方面进步很大。',
          time: '09:20',
          isOwn: false
        },
        {
          id: 3,
          text: '太好了！他在家也经常主动要求学习。',
          time: '09:22',
          isOwn: true
        },
        {
          id: 4,
          text: '这很好！建议继续保持，每天坚持15-20分钟的学习时间。',
          time: '09:25',
          isOwn: false
        }
      ],
      commonEmojis: ['😊', '😄', '😁', '👍', '❤️', '🎉', '👏', '💪', '🌟', '🎈'],
      faqs: [
        {
          question: '如何联系老师？',
          answer: '您可以在老师列表中选择要联系的老师，点击后即可开始聊天。也可以使用快速联系功能发送常见问题。'
        },
        {
          question: '老师一般什么时候在线？',
          answer: '老师通常在工作日的9:00-18:00在线，具体时间可以在老师资料中查看。'
        },
        {
          question: '可以发送文件或图片吗？',
          answer: '是的，您可以通过输入框上方的工具栏按钮发送文件、图片等附件。'
        },
        {
          question: '如何查看孩子的学习报告？',
          answer: '您可以在"学习进度"页面查看详细的学习报告，也可以直接向老师询问。'
        }
      ],
      searchResults: []
    };
  },
  methods: {
    selectTeacher(teacher) {
      this.selectedTeacher = teacher;
      // 清除未读消息数
      teacher.unreadCount = 0;
      // 滚动到底部
      this.$nextTick(() => {
        this.scrollToBottom();
      });
    },
    
    sendMessage() {
      if (!this.newMessage.trim()) return;
      
      const message = {
        id: Date.now(),
        text: this.newMessage,
        time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }),
        isOwn: true
      };
      
      this.messages.push(message);
      this.newMessage = '';
      this.showEmojiPicker = false;
      
      // 模拟老师回复
      setTimeout(() => {
        this.messages.push({
          id: Date.now() + 1,
          text: '收到，我会关注一下。',
          time: new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }),
          isOwn: false
        });
        this.scrollToBottom();
      }, 1000);
      
      this.scrollToBottom();
    },
    
    insertEmoji(emoji) {
      this.newMessage += emoji;
      this.showEmojiPicker = false;
    },
    
    scrollToBottom() {
      const container = this.$refs.messagesContainer;
      if (container) {
        container.scrollTop = container.scrollHeight;
      }
    },
    
    toggleFaq(index) {
      const idx = this.expandedFaqs.indexOf(index);
      if (idx > -1) {
        this.expandedFaqs.splice(idx, 1);
      } else {
        this.expandedFaqs.push(index);
      }
    },
    
    quickContact(type) {
      if (!this.selectedTeacher) {
        alert('请先选择一位老师');
        return;
      }
      
      const templates = {
        question: '您好，想咨询一下孩子最近的学习情况。',
        progress: '您好，想了解一下孩子的学习进度。',
        homework: '您好，关于孩子的作业有一些问题想咨询。',
        suggestion: '您好，希望能获得一些学习建议。'
      };
      
      this.newMessage = templates[type] || '';
      this.sendMessage();
    },
    
    addTeacher(teacher) {
      // 后续实现添加老师功能
      alert(`添加${teacher.name}功能开发中...`);
      this.showAddTeacher = false;
    },
    
    goBack() {
      this.$router.push('/');
    }
  }
};
</script>

<style scoped>
.contact-teacher {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
}

.back-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-5px);
}

.page-header h1 {
  margin: 0;
  color: white;
  font-size: 28px;
  font-weight: 600;
  flex: 1;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.content-container {
  max-width: 1400px;
  margin: 0 auto;
}

.contact-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  margin-bottom: 30px;
  height: 600px;
}

.teachers-sidebar,
.chat-main {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 20px;
}

.add-teacher-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-teacher-btn:hover {
  transform: scale(1.1);
}

.teachers-list {
  flex: 1;
  overflow-y: auto;
}

.teacher-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.teacher-item:hover {
  background: #f8f9fa;
}

.teacher-item.active {
  background: #f0f4ff;
  border-left: 4px solid #667eea;
}

.teacher-avatar {
  position: relative;
  flex-shrink: 0;
}

.teacher-avatar img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.unread-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
}

.online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #27ae60;
  border: 2px solid white;
  border-radius: 50%;
}

.teacher-info {
  flex: 1;
  min-width: 0;
}

.teacher-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 3px;
}

.teacher-subject {
  font-size: 12px;
  color: #7f8c8d;
  margin-bottom: 5px;
}

.teacher-last-message {
  font-size: 12px;
  color: #95a5a6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-time {
  font-size: 11px;
  color: #95a5a6;
  flex-shrink: 0;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.chat-teacher-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-avatar {
  position: relative;
}

.chat-avatar img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-info {
  display: flex;
  flex-direction: column;
}

.chat-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 3px;
}

.chat-status {
  font-size: 12px;
}

.status-online {
  color: #27ae60;
}

.status-offline {
  color: #95a5a6;
}

.chat-actions {
  display: flex;
  gap: 10px;
}

.chat-action-btn {
  width: 35px;
  height: 35px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chat-action-btn:hover {
  background: #e0e0e0;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
}

.message-item {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.message-item.own-message {
  flex-direction: row-reverse;
}

.message-avatar {
  flex-shrink: 0;
}

.message-avatar img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.message-content {
  max-width: 70%;
  background: white;
  padding: 12px 15px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.own-message .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12px;
  opacity: 0.7;
}

.message-text {
  word-wrap: break-word;
  line-height: 1.5;
}

.message-attachments {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.attachment-item {
  font-size: 12px;
  margin-top: 5px;
}

.message-input-area {
  padding: 15px 20px;
  border-top: 1px solid #e0e0e0;
  background: white;
}

.input-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.toolbar-btn {
  width: 35px;
  height: 35px;
  border: none;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toolbar-btn:hover {
  background: #e0e0e0;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 10px;
}

.emoji-item {
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  transition: all 0.3s ease;
}

.emoji-item:hover {
  transform: scale(1.2);
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.message-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
}

.message-input:focus {
  outline: none;
  border-color: #667eea;
}

.send-btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.no-teacher-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #7f8c8d;
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.no-teacher-selected h3 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.add-teacher-main-btn {
  margin-top: 20px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-teacher-main-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.quick-contact-section,
.faq-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.quick-contact-section h2,
.faq-section h2 {
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 25px;
}

.quick-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.quick-contact-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #e0e0e0;
}

.quick-contact-card:hover {
  border-color: #667eea;
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.quick-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.quick-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.quick-desc {
  font-size: 12px;
  color: #7f8c8d;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.faq-item {
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.faq-item:hover {
  border-color: #667eea;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  font-weight: 600;
  color: #2c3e50;
}

.faq-toggle {
  font-size: 20px;
  color: #667eea;
  font-weight: bold;
}

.faq-answer {
  padding: 0 20px 15px 20px;
  color: #7f8c8d;
  line-height: 1.6;
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 20px;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: #f5f5f5;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #7f8c8d;
}

.modal-close:hover {
  background: #e74c3c;
  color: white;
}

.modal-body {
  padding: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  color: #2c3e50;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
}

.search-results {
  margin-top: 20px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-result-item:hover {
  background: #e0e0e0;
}

.result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.result-info {
  flex: 1;
}

.result-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 3px;
}

.result-subject {
  font-size: 12px;
  color: #7f8c8d;
}

.add-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.teacher-info-modal {
  max-width: 400px;
}

.teacher-profile {
  text-align: center;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 15px;
}

.teacher-profile h3 {
  color: #2c3e50;
  margin-bottom: 5px;
}

.profile-subject {
  color: #7f8c8d;
  margin-bottom: 20px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
}

.info-label {
  color: #7f8c8d;
}

.info-value {
  font-weight: 600;
  color: #2c3e50;
}

.profile-description {
  text-align: left;
}

.profile-description h4 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.profile-description p {
  color: #7f8c8d;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .teachers-sidebar {
    max-height: 300px;
  }

  .chat-main {
    min-height: 500px;
  }

  .quick-contact-grid {
    grid-template-columns: 1fr;
  }
}
</style>
